<?php 
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
use frontend\models\Apply;
use frontend\models\Region;

/**
* 个人简历
*/
class ApplyController extends Controller
{
	public $layout='myapply';
	//添加简历
	public function actionApply_info(){
		$model=new Apply();
		$request=Yii::$app->request;
		if($request->isPost){
			$post=$request->post();
			$id=$post['Apply']['UserId'];
			$model->UserId=$id;
			//var_dump($post);die;
			$arr = [];
			foreach($post['Apply'] as $k=>$v){
				if($k=='province'||$k=='city'||$k=='district'){
					$arr[]=$v;
				}
			}
			$model->DesiredCityName=implode(',', $arr);

			//var_dump($model);die;
			
			if($model->load($post) && $model->validate()){
				$res=$model->save();
				if($res){
					return $this->redirect('?r=member/member_list');
				}
			}
		}
		return $this->render('apply_info',['model'=>$model]);
	}
	//个人履历
	public function actionApply_resume(){
		return $this->render('apply_resume');
	}
	//预览/提交
	public function actionApply_review(){
		return $this->render('apply_review');
	}

	public function actions()
    {
        $actions=parent::actions();
        $actions['get-region']=[
            'class'=>\chenkby\region\RegionAction::className(),
            'model'=>\frontend\models\Region::className(),
        ];
        return $actions;
    }
}



 ?>